/*********************************** (C) COPYRIGHT ******************************
 * address: https://gitee.com/liuniansihuo/multitasks-os
 *
 * Change Logs:
 * Date			Author      	Notes
 * 2019-06-16	LiuHuo			first version
 *
*******************************************************************************/
#ifndef __fifo_H_
#define __fifo_H_

//仅支持 unsigned char 类型的FIFO ，其他类型请使用 struct QueRing_s
//注意与struct QueRing_s 的方向定义
//tail总是指向空
struct FIFO_S
{
	unsigned int head;
	unsigned int tail;
	unsigned int size;
	unsigned char *buff;
};

unsigned char fifo_is_full(const struct FIFO_S * Q);
unsigned char fifo_is_empty(const struct FIFO_S * Q);
unsigned int fifo_get_length(const struct FIFO_S * Q);
unsigned int fifo_free_length(const struct FIFO_S * Q);
unsigned char fifo_get_data(const struct FIFO_S * Q,unsigned int offset);
unsigned int fifo_get_datas(struct FIFO_S * Q,unsigned char * buff);
void fifo_discard_one(struct FIFO_S * Q);
void fifo_head_offset(struct FIFO_S * Q, unsigned int offset);
unsigned int fifo_set_data(struct FIFO_S * Q,const unsigned char * buff,unsigned int len);
unsigned int fifo_get_length_continue(const struct FIFO_S * Q);
unsigned char * fifo_get_head_addr(const struct FIFO_S * Q);
unsigned int fifo_get_size(const struct FIFO_S * Q);
void fifo_tail_set(struct FIFO_S * Q,unsigned int tail);





#endif
